#ifndef BOSS_Afterburner_Path_FileInventory_H
#define BOSS_Afterburner_Path_FileInventory_H

/// @addtogroup Afterburner_objects
/// @{
/// @author   Remco de Boer 雷穆克 (r.e.deboer@students.uu.nl or remco.de.boer@ihep.ac.cn)
/// @date     May 23rd, 2019

#include "TString.h"
#include <set>

class FileInventory
{
public:
  FileInventory() {}
  FileInventory(const TString& path, bool recursive = true);

  void AddFile(const TString& path);
  void AddFiles(const TString& path, bool recursive = false);
  void AddFilesRecursive(const TString& path) { AddFiles(path, true); }

  size_t GetNFiles() const { return fFiles.size(); }
  Bool_t IsEmpty() const { return !fFiles.size(); }

  const std::set<TString>& GetFiles() const { return fFiles; }

  TString First() const;
  TString GetCommonPWD() const;

  void Print() const;
  void PrintZombies() const;
  void RemoveZombies();

private:
  std::set<TString> fFiles;
  std::set<TString> fZombies;

  bool IsValidDir(const TString& path);
};

/// @}

#endif